﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;


namespace MyVocationSpace
{
    public partial class AddEditIndustry : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            BAL.conn.connectionString = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;

            if (Session["UserID"] == null)
            {
                Response.Redirect("Home.aspx");
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string indName = txtIndustry.Text;
            string desc = txtDesc.Text;
            int IDTempIndus = BAL.Industry.InsertTempIndustry(Convert.ToInt32(Session["UserID"]), indName, desc);

            idSpanMsg.Style.Add("display", "block");
            idSpanMsg.InnerHtml = "Your request is Accepted and it will be approved by Admin and you will get notified soon";

            DataSet ds = BAL.Industry.GetUserByTempIndustry(IDTempIndus);

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {

                        string content = "<div style=\"margin-left:20px;\">" +
                            "<span style=\"font-size: 12px; font-family: 'CENTURY GOTHIC'\">" +
                            "<br>New Industry added by <b>" + dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + "</b> with following details -<br>" +

                            "<br><b>Industry Name:</b> " + txtIndustry.Text + "<br>" +
                            "<br><b>Description:</b> " + txtDesc.Text + "<br>" +

                      "<br><br>Best Regards, <br><b>" + dr["FirstName"].ToString() + " " + dr["LastName"].ToString() +
                      "</span></div>";

                        //               "<br><p>Follow Us on </p><div class='addthis_toolbox addthis_32x32_style addthis_default_style'>" +
                        //"<a class='addthis_button_facebook_follow' addthis:userid=''></a>" +
                        //"<a class='addthis_button_twitter_follow' addthis:userid='romstermonster'></a></div>" +
                        //"<script type='text/javascript' src='http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fa12a956ba9df5c'></script>" +
                        //           "<div style=\"float:left;margin:0px 5px 0px 5px\" ><a href='' target='_blank'><img src='cid:fb' style='border:0' /></a></div>" +
                        //           "<div style=\"float:left;margin:0px 5px 0px 5px\" ><a href='' target='_blank'><img src='cid:tweet' style='border:0' /></a></div>";

                        //                        
                        string subject = "New Industry Request Detail...";

                        BAL.Common.SendEmail("", ConfigurationManager.AppSettings["AdminID"].ToString(), subject, content);
                    }
                }
            }


            txtIndustry.Text = "";
            txtDesc.Text = "";






        }
    }
}